//公告
import { get_money, money_audit } from "@/api/money";
export default {
  namespaced: true,
  state: {
    page: 1,
    limit: 10,
    status: -1,
    rows: [],
    total: "",
    info: {},
  },
  mutations: {
    toggle: (state, payload) => {
      state.total = payload.total;
      state.rows = payload.rows;
      console.log(state);
    },
    changeState: (state, payload) => {
      state.status = payload;
    },
    modify: (state, payload) => {
      state.info = payload;
    },
  },
  actions: {
    getMoneyList: async ({ commit, state }) => {
      const { page, limit, status } = state;
      const data = await get_money({
        page,
        limit,
        status,
      });
      commit("toggle", data);
    },

    audit: async ({ state }) => {
      const { info } = state;
      console.log(info, "info");
      const { success } = await money_audit(info);
      return success;
    },
  },
  getters: {},
};
